import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {IonicApp, IonicModule, IonicErrorHandler, ActionSheetController, AlertController} from 'ionic-angular';
import { MyApp } from './app.component';

import { TabsPage } from '../pages/tabs/tabs';
import { MapPage } from '../pages/map/map'
import { UnitPage } from '../pages/unit/unit'
import { MePage} from '../pages/me/me'

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { LoadingController } from 'ionic-angular';
import {WgLoading} from "../widget/widget_Loading";
import {WgActionSheet} from "../widget/widget_ActionSheet";
import {WgAlert} from "../widget/widget_Alert";

/* 自定义插件的依赖库*/
import { Toast } from "@ionic-native/toast"
import { ZQHToast } from "../util/zqhToast";
import { NFC } from '@ionic-native/nfc'
import {ZQHNFC} from "../util/zqhNFC";
import { Camera } from '@ionic-native/camera';
import {ImagePicker} from "@ionic-native/image-picker";
import {ZQHCamera} from "../util/zqhCamera";

@NgModule({
  declarations: [
    MyApp,
    MapPage,
    UnitPage,
    MePage,
    TabsPage
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp,{
      tabsHideOnSubPages: 'true'         //隐藏全部子页面tabs
    }),
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    MapPage,
    UnitPage,
    MePage,
    TabsPage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    Toast,
    NFC,
    Camera,
    ImagePicker
  ]
})
export class AppModule {
  constructor(private loaloadingCtrl: LoadingController, private  actionSheetCtrl: ActionSheetController,
    private alertCtrl: AlertController, private toast: Toast, private nfc: NFC, private camera: Camera,
    private imagePicker: ImagePicker
  ){
    WgLoading.loadingCtrl = this.loaloadingCtrl;
    WgActionSheet.actionSheetCtrl = this.actionSheetCtrl;
    WgAlert.alertCtrl = this.alertCtrl;

    ZQHToast.toast = this.toast;
    ZQHNFC.nfc = this.nfc;
    ZQHCamera.camera = this.camera;
    ZQHCamera.imagePicker = this.imagePicker;
  }
}
